<template>
	<view>
		<!-- 待支付 -->
		<!-- v-if="orderDetailsDTO.orderStatus=='10'" -->
		<view class="pay_time fx-row-c" v-if="orderDetailsDTO.status.code=='10'">
			<span class="bold">订单待支付 </span>
			<uv-count-down 
				ref="countDown" 
				:time="timeupSecond" 
				format="DD:HH:mm:ss" 
				autoStart 
				millisecond 
				@change="onChange"
				@finish="finish">
				<view class="time"> 
					<text class="time_item">{{ timeDown.minutes }}</text>:
					<text class="time_item">{{ timeDown.seconds }}</text>
				</view>
			</uv-count-down>
			<span class="grey2">后关闭支付通道</span>
		</view>
		<!-- 进行中 -->
		<!-- <view class="steps"  v-if="orderDetailsDTO.status.code=='30'"  :style="{background: 'url('+ bgurl +'/policy/user_img/my_bg.png)'}"> -->
		<!-- <view class="steps"   :style="{background: 'url('+ bgurl +'/policy/user_img/my_bg.png)'}">
			<view class="stepcon">
				<uv-steps :current="stepCount" activeColor="#FFBF00" activeIcon="checkmark-circle-fill" inactiveIcon="checkmark-circle">
					<uv-steps-item title="已接单" :customStyle="{color:'#000'}"></uv-steps-item> 
					<uv-steps-item title="已出发" ></uv-steps-item> 
					<uv-steps-item title="已到达" ></uv-steps-item> 
					<uv-steps-item title="开始服务" ></uv-steps-item> 
					<uv-steps-item title="服务成功" ></uv-steps-item> 
				</uv-steps>
			</view>
		</view> -->
		<view class="steps"  v-if="orderDetailsDTO.status.code=='30'"  :style="{background: 'url('+ bgurl +'/policy/user_img/my_bg.png)'}">
			<view class="stepcon">
				<view class="steps_box">
					<view class="steps_item" v-for="(item,index) in steps" :key='index'>
						<uv-line v-if="index!=4"></uv-line>
						<image v-if="stepCount<index" src="@/static/picture/step.png" ></image>
						<image v-else src="@/static/picture/step_act.png" ></image>
						<span :class="stepCount==index?'step_act':''">{{item}}</span>
					</view>  
				</view>
			</view>
		</view>
		<!-- 服务项目 -->
		<view class="project">
			<view class="fx-row-sb-c">
				<span class="ft32 bold">服务项目</span>
				<span class="ft28" style="color: #41C088;"   v-if="orderDetailsDTO.status.code=='40'">已完成</span>
				<!-- <span class="ft28 red"  v-if="orderState==1">已超时</span> -->
				<span class="ft28 "  v-if="orderDetailsDTO.status.code=='99'" style="color:#B80048 ;">已取消</span>
				
				<span class="ft28 "  v-if="orderDetailsDTO.status.code=='30'" style="color:#FF7700 ;">进行中</span>
				<span class="ft28 "  v-if="orderDetailsDTO.status.code=='10'" style="color:#F82323 ;">待付款</span>
				<span class="ft28 "  v-if="orderDetailsDTO.status.code=='20'" style="color:#F82323 ;">待接单</span>
			</view>
			<view class="prolist">
				<!-- <view class="fx-row proitem"  v-for="(item,index) in serviceList" :key="item.serviceId"> -->
				<view class="fx-row proitem" > 
					<view class="proimg">
						<image :src="serviceList.cover" mode="heightFix" lazy-load></image>
					</view>
					<view class="proinfo">
						<view class="fx-row-sb-c">
							<span class="ft30">{{serviceList.serviceName}}</span> 
							<span class="ft20">￥<span style="font-size: 26rpx;">{{conversion(serviceList.discountPrice)}}</span></span>
						</view>
						<view class="mt6 ft24 grey1 text-beyond" style="width: 260rpx;">{{serviceList.recommendations}}</view> 
						<view class="fx-row-sb-c mt10 ft24">
							<span>时间 <span  class="ml10 grey2">{{serviceList.duration}}分钟</span></span>
							<span class="grey2">x{{serviceList.orderCount}}</span>   
						</view>
					</view>
				</view>
			</view>
			<view class="fx-col rowtxt ft24">
				<view class="fx-row-sb rowitem"><span>技师姓名</span><span class="grey2 rowri">{{orderDetailsDTO.massagistName}}</span></view>
				<view class="fx-row-sb rowitem"><span>出行方式</span><span class="grey2 rowri">{{orderDetailsDTO.travelType}}</span></view>
				<view class="fx-row-sb rowitem"><span>出行距离</span><span class="grey2 rowri">{{orderDetailsDTO.travelDist}}km</span></view>
				<view class="fx-row-sb rowitem"><span>出行费用</span><span class="grey2 rowri">￥{{conversion(orderDetailsDTO.travelPrice)}}</span></view>
				<view class="fx-row-sb rowitem"><span>优惠券抵扣</span><span class="red rowri">￥{{conversion(orderDetailsDTO.discount)}}</span></view> 
				<view class="fx-row-sb rowitem"><span>团购券抵扣</span><span class="red rowri">￥{{orderDetailsDTO.couponPrice?conversion(orderDetailsDTO.couponPrice):'0.00'}}</span></view> 
				<view class="fx-row-sb rowitem"><span>服务总时长</span><span class="grey2 rowri">{{orderDetailsDTO.totalDuration}}分钟</span></view>
				<view class="fx-row-sb rowitem mt10"><span></span><span class="ft24">合计：<span class="red ft28" style="font-weight: 600;">￥{{conversion(orderDetailsDTO.totalPrice)}}</span></span></view>
			</view>
		</view>
		<!-- 加钟项目 -->
		<block v-if="orderExtList.length!==0">
			<view class="project" v-for="(item,index) in orderExtList" :key="item.extOrderId">
				<view class="fx-row-sb-c">
					<span class="ft32 bold">加钟信息</span> 
				</view>
				<view class="prolist">
					<view class="fx-row proitem" >
						<view class="proimg">
							<image :src="item.cover" mode="heightFix" lazy-load></image>
						</view>
						<view class="proinfo">
							<view class="fx-row-sb-c">
								<span class="ft30">{{item.serviceName}}</span>
								<span class="ft20">￥<span style="font-size: 26rpx;">{{conversion(item.discountPrice)}}</span></span>
							</view>
							<view class="fx-row-sb-c mt16 ft24">
								<span>时间 <span class="ml10 grey2">{{item.duration}}分钟</span></span>
								<span class="grey2">x{{item.orderCount}}</span>
							</view>
						</view>
					</view>
				</view>
				<view class="fx-col rowtxt ft24"> 
					<view class="fx-row-sb rowitem"><span>技师服务加钟时间</span><span class="grey2 rowri">{{item.startTime}}</span></view>
					<view class="fx-row-sb rowitem"><span>加钟服务总时长</span><span class="grey2 rowri">{{item.totalDuration}}分钟</span></view>
					<view class="fx-row-sb rowitem mt10"><span></span><span class="ft24">合计：<span class="red ft28" style="font-weight: 600;">￥{{conversion(item.totalPrice)}}</span></span></view>
				</view>
			</view>
		</block>
		<!-- 客户信息 -->
		<view class="project">
			<view class="fx-row-sb-c">
				<span class="ft32 bold">客户信息</span> 
			</view> 
			<view class="fx-col rowtxt ft24">
				<view class="fx-row-sb rowitem"><span>联系人</span><span class="grey2 rowri">{{orderDetailsDTO.userDTO.name}}</span></view>
				<view class="fx-row-sb rowitem"><span>联系电话</span><span class="grey2 rowri">{{orderDetailsDTO.userDTO.phone}}</span></view>
				<view class="fx-row-sb rowitem"><span>预约时间</span><span class="grey2 rowri">{{orderDetailsDTO.userDTO.appointTime}}</span></view>
				<view class="fx-row-sb rowitem"><span>服务地点</span><span class="grey2 rowri">{{orderDetailsDTO.userDTO.address}}</span></view>
				<view class="fx-row-sb rowitem"><span>订单备注</span><span class="grey2 rowri">{{orderDetailsDTO.remark?orderDetailsDTO.remark:'无'}}</span></view> 
			</view>
		</view>
		<!-- 订单信息 -->
		<view class="project">
			<view class="fx-row-sb-c">
				<span class="ft32 bold">订单信息</span> 
			</view> 
			<view class="fx-col rowtxt ft24">
				<view class="fx-row-sb rowitem"><span>订单编码</span><span class="grey2 rowri">{{orderDetailsDTO.orderCode}}</span></view>
				<view class="fx-row-sb rowitem"><span>支付方式</span><span class="grey2 rowri">{{orderDetailsDTO.priceType}}</span></view>
				<view class="fx-row-sb rowitem"><span>下单时间</span><span class="grey2 rowri">{{orderDetailsDTO.appointTime}}</span></view>
				<!-- 待支付无以下内容 -->
				<block v-if="orderDetailsDTO.status.code!=10">
					<view class="fx-row-sb rowitem"><span>技师接单时间</span><span class="grey2 rowri">{{orderDetailsDTO.takeTime==null?'--':orderDetailsDTO.takeTime}}</span></view>
					<view class="fx-row-sb rowitem"><span>技师出发时间</span><span class="grey2 rowri">{{orderDetailsDTO.departTime==null?'--':orderDetailsDTO.departTime}}</span></view>
					<view class="fx-row-sb rowitem"><span>技师到达时间</span><span class="grey2 rowri">{{orderDetailsDTO.arriveTime==null?'--':orderDetailsDTO.arriveTime}}</span></view> 
					<view class="fx-row-sb rowitem" ><span>技师服务开始时间</span><span class="grey2 rowri">{{orderDetailsDTO.startTime==null?'--':orderDetailsDTO.startTime}}</span></view> 
					<!-- <view class="fx-row-sb rowitem" v-if="orderExtList.length!==0"><span>技师服务加钟时间</span><span class="grey2 rowri">{{orderDetailsDTO.extraTime==null?'--':orderDetailsDTO.extraTime}}</span></view> -->
					<view class="fx-row-sb rowitem"><span>技师服务完成时间</span><span class="grey2 rowri">{{orderDetailsDTO.endTime==null?'--':orderDetailsDTO.endTime}}</span></view> 
					<view class="fx-row-sb rowitem"  v-if="orderDetailsDTO.status.code==99"><span>取消订单时间</span><span class="grey2 rowri">{{orderDetailsDTO.cancelTime==null?'--':orderDetailsDTO.cancelTime}}</span></view> 
					<view class="fx-row-sb rowitem"  v-if="orderDetailsDTO.status.code==99"><span>取消原因</span><span class="grey2 rowri">{{orderDetailsDTO.cancelReason==null?'--':orderDetailsDTO.cancelReason}}</span></view> 
				</block>
			</view>
		</view>  
		<!-- 底部栏 --> 
		<!-- v-if="orderDetailsDTO.status.code!='40'" -->
		<!-- 订单完成无底部栏	 --> 
		<block >
			<view style="width: 100%;height: 115rpx;"></view>
			<view class="fx-row-end-c orderbtn ">   
				<!-- 已超时 -->
				<span  v-if="orderDetailsDTO.status.code=='超时' || orderDetailsDTO.status.code=='99'" class="btn obtn2" @click="againOrder">再来一单</span>  
				<!-- 待支付 -->  
				<span v-if="orderDetailsDTO.status.code=='10' || orderDetailsDTO.status.code=='20' || (orderDetailsDTO.status.code=='30'&&(orderDetailsDTO.operateStatus.code=='31'||orderDetailsDTO.operateStatus.code=='32'||orderDetailsDTO.operateStatus.code=='33'))" class="btn obtn1" @click="escOrders">取消订单</span> 
				<span v-if="orderDetailsDTO.status.code=='10'" class="btn obtn2" @click="goPay(orderDetailsDTO.id)">立即支付</span>  
				<!-- 进行中 -->
				<span  v-if="orderDetailsDTO.status.code=='30'&&(orderDetailsDTO.operateStatus.code=='34'||orderDetailsDTO.operateStatus.code=='35')" class="btn obtn2" @click.stop="addTime(item,index)">立即加钟</span> 
				<!-- <span class="obtn2" @click.stop="addTime()">立即加钟</span>  --> 
				<!-- 已完成 -->
				<span  v-if="orderDetailsDTO.status.code=='40' && !orderDetailsDTO.hasComments" class="btn obtn3" @click.stop="appraise(orderDetailsDTO)">立即评价</span>  
			</view> 
		</block> 
		<!-- 取消订单 -->
		<uv-popup  ref="escpop" mode='bottom'  zIndex='991' round="12" duration='300' closeable >
			<view class="esccon">
				<view class="ft32 ta">取消订单</view>
				<uv-radio-group class="escgroup mt16" v-model="radiovalue" @change="cradio" placement="column" iconPlacement="right" activeColor="#AD8539" labelSize="14">
					<uv-radio 
						:customStyle="{height: '80rpx'}" 
						v-for="(item, index) in radiolist" 
						:key="index" 
						:label="item.name" 
						:name="item.name">
					</uv-radio>
				</uv-radio-group> 
				<view class="escbtn" @click="sureEsc">确认取消</view>
			</view>
		</uv-popup>
		<!-- 预约弹窗 -->
		<uv-popup mode='bottom'  zIndex='991' round="12" duration='300' closeable ref="popup" >
				<subscribeList ref="cou" :state="stateindex" :projectList="projectLists" :projectInfo="projectInfo" @addProject='addProject'  @goInfor='goInfor'></subscribeList>
		</uv-popup>
	</view>
</template>

<script>
	import { orderDetails,escOrder,extraTime,massagistDetails,geturl,extOrderPay,orderPay } from '@/utils/api.js'
	import badgeMix from '@/common/mixins.js' 
	import subscribeList from '@/components/subscribe-list.vue' 
	import config from '@/config.js' 
	export default {
		mixins: [badgeMix],
		components:{subscribeList},
		data() {
			return { 
				timeDown:{}, //倒计时
				timeupSecond:'',
				orderState:'0',  //0 待支付   1已超时  2进行中   3已完成  4已取消 
				stepCount:0,  //进行中状态
				steps:['已接单','已出发','已到达','开始服务','服务完成'],
				radiolist: [
					{
						name: '行程有变',
						disabled: false
					}, {
						name: '时间太晚',
						disabled: false
					},{
						name: '车费太贵',
						disabled: false
					}, {
						name: '超出接单范围',
						disabled: false
					}, {
						name: '等待时间太长',
						disabled: false
					}, {
						name: '支付出现异常',
						disabled: false
					}, {
						name: '其他原因',
						disabled: false
					} ,
				],
				radiovalue: '',
				escReason:'',
				id:'', 
				timeData:{
					'orderId':'',
					'serviceId':'',
					'massagistId':'',
					'orderCount':'',
					// #ifdef MP-WEIXIN
					"source" : 'WeChatMini',
					"version" : config.appInfo.version
					// #endif
				},
				orderExtList:[], //加钟订单信息 
				orderDetailsDTO:{},//订单信息 
				serviceList:[],  //服务项目
				projectLists:[],
				projectInfo:{},
				stateindex:'1',
				beforePage1:{},
				bgurl:config.imageUrl, 
			};
		},
		onShow() { 
			
		},
		 //监听页面返回 
		// onUnload() { 
		// 	// #ifdef H5
		// 	this.beforePage1.orderPayBack();
		// 	// #endif
		// 	// #ifndef H5
		// 	this.beforePage1.$vm.orderPayBack();
		// 	// #endif
		// 	 //需要修改的上一个界面的信息，可以在此处进行更改 
		// }, 
		onLoad(option) {
			this.id = option.id
			if(option.state == 'info'){
				uni.setNavigationBarTitle({
					title: '订单详情', 
				});
			}else{
				uni.setNavigationBarTitle({ 
					title: '待支付'
				});
			} 
			this.orderInfo(option.id)
			let pages1 = getCurrentPages(); // 当前页面
			this.beforePage1 = pages1[pages1.length - 2]; // 上一页   
		},
		methods: {   
			// 订单详情
			orderInfo(id){
				uni.showLoading({
					title: '加载中'
				});
				orderDetails({'id':id}).then((res) => {
					console.log(res);  
					uni.hideLoading() 
					if(res.code == '200'){  
						this.orderExtList = res.result.orderExtList?res.result.orderExtList:[] 
						this.orderDetailsDTO = res.result   //订单详情 
						// this.serviceList = res.result.serviceList
						this.serviceList = res.result.serviceDTO
						if(res.result.status.code == '30'){ // 技师进行中状态 
							switch ( res.result.operateStatus.code) {
								 case 31 :
									this.stepCount = 0
									 break;
								 case 32 :
									 this.stepCount = 1
									 break;
								 case 33:
									 this.stepCount = 2
									 break;
								 case 34:
									 this.stepCount = 3
									 break;
								 case 35:
										this.stepCount = 4
								 break;
								 default:
									this.stepCount = -1
								break;
							}  
						}
						if(res.result.status.code == '10'){
							this.timeDowns(res.result.appointTime)
						}
						
					}
				}) 
			}, 
			// 待支付倒计时
			timeDowns(createTime){
				console.log(createTime,this.dataMs(createTime,120000),"创建时间");
				if(this.dataMs(createTime,600000) < 0){
					this.timeupSecond=0   
					// this.orderInfo(this.id) 
				}else{
					this.timeupSecond = this.dataMs(createTime,600000)   
				} 
			}, 
			cradio(e){
				console.log(e);
			},
			// 取消订单
			escOrders(){ 
				this.$refs.escpop.open(); 
			},
			// 确定取消
			sureEsc(){  
				// #ifdef MP-WEIXIN
				this.source = 'WeChatMini'
				// #endif 
				// #ifdef H5 
				this.source = 'WeChat'
				// #endif
				if(!this.radiovalue){
					return uni.showToast({
						title:'请选择取消原因！',icon:'none'
					})
				} 
				this.$refs.escpop.close(); 
				escOrder({'id':this.id,'cancelReason':this.radiovalue,"source":this.source}).then((res) => {
					console.log(res);  
					this.radiovalue = ''
					if(res.code == '200'){
						uni.showToast({
							title:'订单已取消！',
							icon:'none'
						})
						setTimeout(()=>{
							this.orderInfo(this.id)
						},1000)
					}else{
						uni.showToast({
							title:res.message,
							icon:'none'
						})
						if(res.message=='取消失败，技师已经开始服务了哦'){ 
							setTimeout(()=>{
								this.orderInfo(this.id)
							},1000)
						} 
					}
				}) 
			},
			// 再来一单
			againOrder(){
				uni.reLaunch({
					url:'/pages/index/index'
				})
				// 项目id  技师id  项目数量
				// uni.navigateTo({
				// 	url:`/pages/order/orderPay?pid=${this.serviceList[0].serviceId}&mid=${this.orderDetailsDTO.massagistId}&num=1`
				// }) 
			},
			// 立即加钟弹窗
			addTime(){
				// 技师详情
				this.timeData.orderId = this.orderDetailsDTO.id
				this.timeData.massagistId = this.orderDetailsDTO.massagistId 
				massagistDetails(this.timeData).then(async(res) => { 
					if(res.code == '200'){ 
						res.result.serviceList.forEach((item,index)=>{
							res.result.serviceList[index].num = 0
						})
						this.projectLists = res.result.serviceList
						this.projectInfo = res.result 
					}
				}) 
				this.$refs.popup.open('bottom');
			},
// 立即评价
			appraise(item){
				console.error("详情",item)
				uni.navigateTo({
					url:"/pages/evaluate/evaluate?id="+item.id+"&massagistId="+item.massagistId+"&massagistName="+item.massagistName+"&endTime="+item.endTime+"&massagistWorkPhoto="+encodeURIComponent(JSON.stringify(item.massagistWorkPhoto))
				})
			},
			// 评价成功回调
			refresData(){
				this.orderInfo(this.id)  
			},
			// 项目详情
			goInfor(projectId){ 
				this.$refs.popup.close(); 
				uni.navigateTo({
					url:'/pages/index/details?id='+projectId
				})
			},
			// 加钟回调
			addProject(addOrderId,num,mid){
				console.log(addOrderId,"接收数据1");  
				this.timeData.serviceId = addOrderId
				this.timeData.orderCount = num 
				this.timeData.massagistId = mid
				this.$refs.popup.close();  
				extraTime(this.timeData).then((res) => {
					console.log(res);  
					if(res.code == '200'){
						// 加钟后直接支付
						this.extPay(res.result.id,res.result.orderId) 
					}else{
						uni.showToast({
							title:res.message,
							icon:'none'
						})
						if(res.message=='该订单状态不可加钟'){
							setTimeout(()=>{
								this.orderInfo(this.id)
							},1000)
						} 
					}
				})  
				// 加钟后支付
			}, 
			// 加钟支付
			extPay(extOrderId,orderId){ 
				var _this = this
				// #ifdef MP-WEIXIN
				this.source = 'WeChatMini'
				// #endif 
				// #ifdef H5 
				this.source = 'WeChat'
				// #endif
				extOrderPay({"extOrderId":extOrderId,"openId":uni.getStorageSync('OPENID'),"source":this.source}).then((paydata)=>{ 
					// #ifdef MP-WEIXIN
					this.mpPay(paydata.result,orderId,'ext')   
					// #endif
					
					// #ifdef H5 
					WeixinJSBridge.invoke('getBrandWCPayRequest', { 
							"appId": paydata.result.appId,     //公众号ID，由商户传入     
							"timeStamp": paydata.result.timeStamp,     //时间戳，自1970年以来的秒数     
							"nonceStr": paydata.result.nonceStr,        //随机串     
							"package": paydata.result.packAge, 
							"signType": paydata.result.signType,    //微信签名方式：     
							"paySign":  paydata.result.paySign,  //微信签名 
					},
					function(res){
						// alert(JSON.stringify(res))
						if (res.err_msg == 'get_brand_wcpay_request:ok') { 
								uni.showToast({
									title:'您已加钟，请享受服务！',
									icon:'none'
								})
							// 调用详情刷新数据
							_this.orderInfo(orderId)  
						}
						if (res.err_msg == 'get_brand_wcpay_request:cancel') {
							uni.showToast({
								title:'支付取消！',
								icon:'none'
							})
						}
						
					} )
					// this.$u.init(()=>{
					// 	this.$u.wxpay({
					// 		timeStamp: paydata.result.timestamp,
					// 		nonceStr: paydata.result.nonceStr,  
					// 		package: paydata.result.packAge,  
					// 		signType: paydata.result.signType,
					// 		paySign: paydata.result.paySign,  
					// 		success:()=>{
					// 			uni.showToast({
					// 				title:'支付成功！'
					// 			})
					// 			// 调用详情刷新数据
					// 			_this.orderInfo(orderId) 
					// 		},
					// 		fail:()=>{
					// 			uni.showToast({
					// 				title:'支付失败！',
					// 				icon:'none'
					// 			})
					// 		}
					// 	})
					// })  
					// #endif
				})
			},
			// 支付
			async goPay(orderId){ 
				// #ifdef MP-WEIXIN
				await this.subScribeMsg().then(result => {
					console.log(result,'订阅');
					// 处理操作成功的情况，result为操作成功的结果
				}).catch(error => {
					// 处理操作失败的情况，error为发生的错误
				});
				// #endif 
				var _this = this
				// #ifdef MP-WEIXIN
				this.source = 'WeChatMini'
				// #endif 
				// #ifdef H5 
				this.source = 'WeChat'
				// #endif
				orderPay({"orderId":this.orderDetailsDTO.id,"openId":uni.getStorageSync('OPENID'),"source":this.source}).then((paydata)=>{ 
					// #ifdef MP-WEIXIN
					this.mpPay(paydata.result,orderId)   
					// #endif
					
					// #ifdef H5 
					WeixinJSBridge.invoke('getBrandWCPayRequest', {
							"appId": paydata.result.appId,     //公众号ID，由商户传入     
							"timeStamp": paydata.result.timeStamp,     //时间戳，自1970年以来的秒数     
							"nonceStr": paydata.result.nonceStr,        //随机串     
							"package": paydata.result.packAge, 
							"signType": paydata.result.signType,    //微信签名方式：     
							"paySign":  paydata.result.paySign,  //微信签名 
					},
					function(res){
						if (res.err_msg == 'get_brand_wcpay_request:cancel') {
							uni.showToast({
								title:'支付失败！',
								icon:'none'
							}) 
						}
						if (res.err_msg == 'get_brand_wcpay_request:ok') {
							uni.showToast({
								title:'支付成功！'
							})
							// 调用详情刷新数据
							_this.orderInfo(orderId) 
						}
					}) 
					// this.$u.init(()=>{
					// 	this.$u.wxpay({
					// 		timeStamp: paydata.result.timestamp,
					// 		nonceStr: paydata.result.nonceStr,  
					// 		package: paydata.result.packAge,  
					// 		signType: paydata.result.signType,
					// 		paySign: paydata.result.paySign,  
					// 		success:()=>{
					// 			uni.showToast({
					// 				title:'支付成功！'
					// 			})
					// 			// 调用详情刷新数据
					// 			_this.orderInfo(orderId) 
					// 		},
					// 		fail:()=>{
					// 			uni.showToast({
					// 				title:'支付失败！',
					// 				icon:'none'
					// 			})
					// 		}
					// 	})
					// })  
					// #endif
				})
			},
			//小程序支付
			mpPay(paydata,orderId,source){
				var _this = this
				uni.requestPayment({
					provider:'wxpay',  
					timeStamp:paydata.timeStamp,
					nonceStr:paydata.nonceStr,
					package: paydata.packAge,
					signType:paydata.signType,
					paySign:paydata.paySign,
					success: function (res) {  
						if(source == 'ext'){
							uni.showToast({
								title:'您已加钟，请享受服务！'
							})
						}else{
							uni.showToast({
								title:'支付成功！'
							})
						} 
						_this.orderInfo(orderId) 
						console.log('success:' + JSON.stringify(res));
					},
					fail: function (err) {
						uni.showToast({
							title:'支付失败！',
							icon:'none'
						})
						console.log('fail:' + JSON.stringify(err));
					}
				})
			},
			onChange(e) { 
				this.timeDown = e 
			},
			finish(e){
				console.log(e,'finish');
				this.orderInfo(this.id)
			},
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #F8F8F8;
	}
	.pay_time{
		width: 100%;
		height: 90rpx;
		background-color:#FFF7EA ;
		font-size: 26rpx;
		line-height: 90rpx;
		.time{
			color: #FF0000;
			.time_item{
				margin:0 8rpx;
				padding: 4rpx 12rpx;
				background-color: #FFEEE7;
			}
		}
	}
	.steps{
		width: 710rpx;
		padding: 20rpx;
		background-size: 100% auto !important;
		// box-sizing: border-box; 
		// background-color:$uni-main ;
		.stepcon{
			// width: 642rpx;
			// padding: 54rpx 34rpx 38rpx 34rpx;
			width: 100%;
			padding: 54rpx 0 38rpx 0;
			background:rgba(0, 0,0 ,.3);
			border-radius: 16rpx;
			.steps_box{
				display: flex;
				justify-content: space-between;
				align-items: center;
				.steps_item{
					position: relative;
					display:flex;
					flex-direction:column;
					justify-content:space-between;
					align-items:center;
					width: 142rpx;
					font-size: 26rpx;
					color: #fff;
					.uv-line{ 
						position: absolute;
						top: 10rpx;
						left: 81rpx;
						width: 122px;
						height: 1rpx;
						background-color:#FFBF00 ;
					} 
					.step_act{
						color: #FFBF00;
					}
					image{
						width: 24rpx;
						height: 24rpx;
						margin-bottom: 18rpx;
					}
				} 
			}
		}
	}
	.project{
		width:658rpx;
		margin: 16rpx 12rpx;
		padding:20rpx 34rpx;
		background-color:  #fff;
		border-radius: 12rpx;
		.prolist{
			padding: 24rpx 0 16rpx 0;
			border-bottom: 1rpx solid $uni-color-line;
			.proitem{
				margin-bottom: 16rpx;
				.proimg{
					width: 124rpx;
					height: 124rpx;
					margin-right: 24rpx;
					border-radius: 6rpx;
					overflow: hidden;
					image{
						height: 100%;
					}
				}
				.proinfo{
					width:510rpx ;
				}
			}
		}
		.rowtxt{
			margin-top: 16rpx;
			.rowitem{
				padding: 8rpx 0;
				.rowri{
					width:440rpx ;
					text-align: right;
				}
			}
		}
	}
	.orderbtn{
		position: fixed;
		bottom: 0;
		left: 0;
		width: 700rpx;
		height: 115rpx;
		padding: 0 25rpx;
		background-color: #fff;
		border-top: 1rpx solid $uni-color-line;
		.btn{
			width: 164rpx;
			height: 64rpx;
			margin-left: 20rpx; 
			border-radius: 38rpx;
			font-size: 28rpx;
			text-align: center;
			line-height: 64rpx;
		}
		.obtn1{ 
			border: 1rpx solid #D1D1D1;  
		}
		.obtn2{ 
			border: 1rpx solid $uni-main;
			color: $uni-main; 
		}
		.obtn3{
			border: 1rpx solid $uni-main-warning;
			color: $uni-main-warning;
		}
	}
	.esccon{
		width: 670rpx;
		padding: 45rpx 40rpx;
		.escgroup{
			// height: 700rpx;
			// overflow-y: auto; 
		}
		.escbtn{
			width: 670rpx;
			height: 88rpx;
			margin-top: 40rpx;
			background-color: $uni-main;
			font-size: 36rpx;
			color: #fff;
			text-align: center;
			line-height: 88rpx;
			border-radius: 50rpx;
		}
	}
</style>
